<?php

namespace app\api\controller;

use think\facade\Request;

class Qq
{
    /**
     * QQ录入1
     */
    public function post1()
    {
        $post = Request::only(['qq','zqq','nickname'],'post');
        if (!isset($post['qq']) || !isset($post['zqq'])){
            return result(1,'qq或主qq不能为空');
        }
        if (!ctype_digit($post['qq']) || !ctype_digit($post['zqq'])){
            return result(1,'qq或主qq只能为纯数字');
        }
        try{
            (new \app\admin\model\Qq2)->save($post);
        }catch (\Exception $e){
            return result(1, '录入出错：'.$e->getMessage());
        }
        return result(0, '录入成功');
    }
    
    /**
     * QQ录入2
     */
    public function post2()
    {
        $post = Request::only(['qq','zqq','content','nickname'],'post');
        if (!isset($post['qq']) || !isset($post['zqq'])){
            return result(1,'qq或主qq不能为空');
        }
        if (!ctype_digit($post['qq']) || !ctype_digit($post['zqq'])){
            return result(1,'qq或主qq只能为纯数字');
        }
        try{
            (new \app\admin\model\Qq)->save($post);
        }catch (\Exception $e){
            return result(1, '录入出错：'.$e->getMessage());
        }
        return result(0, '录入成功');
    }
}